<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('销售合同跟踪查询')" />
	<th:block th:include="include :: list-css" />
	<style type="text/css">
		.layui-tab-content{border: 1px solid;padding: 10px 15px;}
		.layui-tab-title li{font-weight:600}
		.layui-tab{margin:0}
	</style>
</head>
<body>
<div class="mid-content">
	<div class="layui-tab" lay-filter="dhtab">
	  <ul class="layui-tab-title">
	    <li class="layui-this" listUrl="/business/bargainin/list" listName="销售合同">合同明细</li>
	    <li listUrl="/business/bargainin/list" listName="订货申请">订货情况</li>
	    <li listUrl="/business/bargainin/list" listName="采购入库">入库情况</li>
	    <li listUrl="/business/bargainin/list" listName="销售出库">出库情况</li>
	    <li listUrl="/business/gatheringbargain/list" listName="合同收款">收款情况</li>
	    <li listUrl="/business/bargainin/list" listName="销售开票">开票情况</li>
	  </ul>
	  <div class="layui-tab-content">
	    <table class="layui-hide" id="dhtable" lay-filter="ftable"></table>
	  </div>
	</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: businessJS" />
<script th:inline="javascript">
	/*<![CDATA[*/
	var prefix = ctx + [[${prefix}]],
		bid=[[${bid}]],
		business=[[${business}]];
	/*]]>*/
</script>
<script type="text/javascript">
var gridBodyMap=[];//表格列集合
$(".layui-tab-content").css("border-color",pellucidityTen)
gridBodyMap[0]=[//合同明细
	{fixed: "left", width: 40,type: "numbers"},
	{width: 100, sort: true, field: "iid", title: "行号"},
	{width: 150, sort: true, field: "gBrand", title: "品牌"},
	{width: 100, sort: true, field: "gSerial", title: "系列"},
	{width: 200, sort: true, field: "gID", title: "型号"},
	{width: 100, sort: true, field: "gModel", title: "规格"},
	{width: 100, sort: true, field: "gName", title: "品名"},
	{width: 200, sort: true, field: "gIDC", title: "客户型号"},
	{width: 100, sort: true, field: "gIndex", title: "订货号"},
	{width: 130, sort: true, field: "vWlBh", title: "物料编号"},
	{width: 100, sort: true, field: "gUnit", title: "单位"},
	{width: 100, sort: true, field: "bNumb", title: "数量", totalRow: true},
	{width: 100, sort: true, field: "bPrice", title: "单价"},
	{width: 100, sort: true, field: "fSumje", title: "金额", totalRow: true},
	{width: 170, sort: true, field: "dHthq", title: "合同货期"},
	{width: 100, sort: true, field: "fSe", title: "税额"},
	{width: 100, sort: true, field: "gPrice", title: "成本价"},
	{width: 110, sort: true, field: "fWsDj", title: "未税单价"},
	{width: 110, sort: true, field: "fWsJe", title: "未税金额"},
	{width: 110, sort: true, field: "fDxMl", title: "单项毛利", totalRow: true},
	{width: 110, sort: true, field: "fHtzk", title: "合同折扣"},
	{width: 110, sort: true, field: "fHsMj", title: "含税面价"},
	{width: 110, sort: true, field: "fWsMj", title: "未税面价"},
	{width: 110, sort: true, field: "fSdSl", title: "锁定数量", totalRow: true},
	{width: 150, sort: true, field: "fSdSl2", title: "锁定保存数量", totalRow: true},
	{width: 110, sort: true, field: "fSqSl", title: "申请数量", totalRow: true},
	{width: 150, sort: true, field: "fSqSl2", title: "申请保存数量", totalRow: true},
	{width: 110, sort: true, field: "fCgSl", title: "采购数量", totalRow: true},
	{width: 110, sort: true, field: "fRkSl",  title: "入库数量", totalRow: true},
	{width: 110, sort: true, field: "fKcSl", title: "库存数量", totalRow: true},
	{width: 110, sort: true, field: "fCkSl", title: "出库数量", totalRow: true},
	{width: 110, sort: true, field: "fKpSl", title: "开票数量", totalRow: true},
	{width: 150, sort: true, field: "fKpSl2", title: "开票保存数量", totalRow: true},
	{width: 110, sort: true, field: "fDkJe", title: "到款金额", totalRow: true},
	{width: 150, sort: true, field: "fDkJe2", title: "到款保存金额", totalRow: true},
	{width: 110, sort: true, field: "fThSl", title: "退货数量", totalRow: true},
	{width: 110, sort: true, field: "fDkBl", title: "到款比例", totalRow: true},
	{width: 200, sort: true, field: "vBz", title: "备注"}
	]
gridBodyMap[1]=[//订货情况
	{fixed: "left", width: 40,type: "numbers"},
	{width: 150, sort: true, field: "gBrand", title: "品牌"},
	{width: 100, sort: true, field: "gSerial", title: "系列"},
	{width: 200, sort: true, field: "gID", title: "型号"},
	{width: 100, sort: true, field: "gModel", title: "规格"},
	{width: 100, sort: true, field: "gName", title: "品名"},
	{width: 100, sort: true, field: "gIndex", title: "订货号"},
	{width: 100, sort: true, field: "gUnit", title: "单位"},
	{width: 100, sort: true, field: "bNumb", title: "合同数量", totalRow: true},
	{width: 110, sort: true, field: "fSqSl", title: "申请数量", totalRow: true},
	{width: 150, sort: true, field: "fSqSl2", title: "申请保存数量", totalRow: true},
	{width: 110, sort: true, field: "fSdSl", title: "锁定数量", totalRow: true},
	{width: 150, sort: true, field: "fSdSl2", title: "锁定保存数量", totalRow: true},
	{width: 110, sort: true, field: "fCgSl", title: "采购数量", totalRow: true}
	]
gridBodyMap[2]=[//入库情况
	{fixed: "left", width: 40,type: "numbers"},
	{width: 150, sort: true, field: "gBrand", title: "品牌"},
	{width: 100, sort: true, field: "gSerial", title: "系列"},
	{width: 200, sort: true, field: "gID", title: "型号"},
	{width: 100, sort: true, field: "gModel", title: "规格"},
	{width: 100, sort: true, field: "gName", title: "品名"},
	{width: 100, sort: true, field: "gIndex", title: "订货号"},
	{width: 100, sort: true, field: "gUnit", title: "单位"},
	{width: 100, sort: true, field: "bNumb", title: "合同数量", totalRow: true},
	{width: 110, sort: true, field: "fCgSl", title: "采购数量", totalRow: true},
	{width: 110, sort: true, field: "fRkSl",  title: "入库数量", totalRow: true}
	]
gridBodyMap[3]=[//出库情况
	{fixed: "left", width: 40,type: "numbers"},
	{width: 150, sort: true, field: "gBrand", title: "品牌"},
	{width: 100, sort: true, field: "gSerial", title: "系列"},
	{width: 200, sort: true, field: "gID", title: "型号"},
	{width: 100, sort: true, field: "gModel", title: "规格"},
	{width: 100, sort: true, field: "gName", title: "品名"},
	{width: 100, sort: true, field: "gIndex", title: "订货号"},
	{width: 100, sort: true, field: "gUnit", title: "单位"},
	{width: 100, sort: true, field: "bNumb", title: "合同数量", totalRow: true},
	{width: 110, sort: true, field: "fKcSl", title: "库存数量", totalRow: true},
	{width: 110, sort: true, field: "fCkSl", title: "出库数量", totalRow: true},
	{width: 110, sort: true, field: "fThSl", title: "退货数量", totalRow: true}
	]
gridBodyMap[4]=[//收款情况
	{fixed: "left", width: 40,type: "numbers"},
	{width: 200, sort: true, field: "bid", title: "收款单号"},
	{width: 150, sort: true, field: "fHtJe", title: "合同金额", totalRow: true},
	{width: 150, sort: true, field: "fSumje", title: "收款金额", totalRow: true},
	{width: 150, sort: true, field: "fWskJe", title: "未收款金额", totalRow: true},
	{width: 150, sort: true, field: "fDkJe", title: "已到款金额", totalRow: true},
	{width: 150, sort: true, field: "fDkJe2", title: "到款保存金额", totalRow: true},
	{width: 150, sort: true, field: "fTkJe", title: "退款金额", totalRow: true},
	{width: 150, sort: true, field: "fTkJe2", title: "退款保存金额", totalRow: true}
	]
gridBodyMap[5]=[//开票情况
	{fixed: "left", width: 40,type: "numbers"},
	{width: 200, sort: true, field: "bid", title: "开票单号"},
	{width: 150, sort: true, field: "gBrand", title: "品牌"},
	{width: 100, sort: true, field: "gSerial", title: "系列"},
	{width: 200, sort: true, field: "gID", title: "型号"},
	{width: 100, sort: true, field: "gModel", title: "规格"},
	{width: 100, sort: true, field: "gName", title: "品名"},
	{width: 100, sort: true, field: "gIndex", title: "订货号"},
	{width: 100, sort: true, field: "gUnit", title: "单位"},
	{width: 100, sort: true, field: "bNumb", title: "合同数量", totalRow: true},
	{width: 110, sort: true, field: "fKpSl", title: "开票数量", totalRow: true},
	{width: 150, sort: true, field: "fKpSl2", title: "开票保存数量", totalRow: true}
	]
var $,layer,form,element,table,wherestr={};
layui.use(['table','form','layer','jquery','element'], function () {
    $ = layui.$, layer = layui.layer, form = layui.form, table = layui.table, element = layui.element;
    $.tablelist.init({//默认加载合同明细
        elem: '#dhtable'
        ,url: prefix + '/list'
   	 	,where: {'bid':bid}
    	,even:true
        ,totalRow: true
        ,cols:[gridBodyMap[0]
	 	]
		,height:'full-100'
    });
	//监听排序事件 
    table.on('sort(ftable)', function(obj){
    	$.tablelist.sort('dhtable',obj);
    });
  	//双击行事件：查看单据
	table.on('rowDouble(ftable)', function(obj){
		var tabThis=$('.layui-tab-title').find('.layui-this'),//获取当前选中tab页dom节点
			tName=tabThis.attr('listName'),
			tUrl=tabThis.attr('listUrl');
		if(tName)parent.layui.index.openTabsPage(tUrl.replace('/group','').replace('list','edit?nid=')+obj.data.nid, tName+'('+obj.data.bid+')');
    });
	//监听Tab页
 	element.on('tab(dhtab)', function(data){
 		var wherestr=($.inArray(data.index,[0,1,2,3,5])<0)?{'htbid':bid}:{'bid':bid};
 		$.tablelist.init({//表格需重新初始化，重载会继承初始化的参数（不可行）
 			elem: '#dhtable',
 			url:$(this).attr('listUrl'),
 			even:true,
 			where:wherestr,
 	        height:'full-100',
 	       	totalRow: true,
			cols:[gridBodyMap[data.index]
			]
 		});
	});
 });
</script>
</body>
</html>